import {defineStore} from "pinia";
import ajax from '@/http/ajax'
import {type Ref, ref} from "vue";
import type {TToDoList} from "@/types";


export const useToDoList = defineStore('toDo', () => {
    const data: Ref<TToDoList> = ref([])
    function getData() {
        ajax({
            url: '/posts',
            method: 'GET'
        }).then((r) => {
            console.log(r.data)
            data.value = r.data
        })
    }
    getData()
    return {data, getData}
})